
#include <wx/protocol/http.h>
#include "action.hpp"

enum HTTP_TYPE{
    HTTP_CURL, HTTP_WX
};
/*
 *
 */
class QueryGitIpAction: public NormalAction
{
public:
    QueryGitIpAction ( MyTagApp *myTagApp1, wxWindow* parent, wxString name );
    bool Prepare() override;
    bool Perform() override;

    void setHttpType( HTTP_TYPE _httpType ){
        this->httpType = _httpType;
    }
protected:
    static size_t write_data ( void* buffer, size_t size, size_t nmemb, void *stream );
    wxString responseBody;
    int len;

    HTTP_TYPE httpType;

private:
    bool wxHttp();
    bool curlHttp();

    wxInputStream* GetInputStream(wxHTTP * & url_handler, const wxString& location );
};


